package com.api.fc;

import java.util.Map;

import cn.hutool.http.HttpRequest;
import cn.hutool.json.JSONArray;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;



public class TestApi002 {

    public static void main(String[] args) {

        //String result = HttpRequest.get("http://oa.maxwell-gp.com.cn:8090/api/fc_ks/get_dts?requestid=933340,508118").execute().body();
        String result = HttpRequest.get("http://oa.maxwell-gp.com.cn:8090/api/fc_ks/get_mains?requestid=&bh=NP202304038358,NI2023012013322").execute().body();
       // String result = HttpRequest.get("http://192.168.0.16:8899/api/fc_ks/get_mains?requestid=&bh=NP202304038358,NI2023012013322").execute().body();
        String jsonString =result;
        String out;

        Object succesResponse = JSON.parse(jsonString);
        Map map = (Map)succesResponse;
        JSONArray jsonArray = new JSONArray(map.get("result"));


        for( int i=0;i<jsonArray.size();i++){
            System.out.println("第"+(i+1)+"条开始.........");
            System.out.println(jsonArray.get(i));
            JSONObject info = new JSONObject((Map<String, Object>) jsonArray.get(i));
            System.out.print("requestid:"+info.get("requestid")+"    ");
            System.out.println("nodename:"+info.get("nodename"));
        }


    }

}

